xm: Fix control characters causing xm tests to fail.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 6 Aug 2007 12:42:15 +0000 (13:42 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 6 Aug 2007 12:42:15 +0000 (13:42 +0100)
On my FC7 installation some of the test in the xm test suite fail for
no apparent reason. The problem is that the python 'readline' module
puts out control characters that confuse code that parses the output
of some of the xm commands that are being run. The readline module
dumps those characters upon import. The attached patch works around
this problem.

Here's what I get in out.txt when doing 'python 2>&1 | tee out.txt'
and 'import readline' on the python command line:

Python 2.5 (r25:51908, Apr 10 2007, 10:29:13)
[GCC 4.1.2 20070403 (Red Hat 4.1.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
[[?1034h>>> >>>

The characters before the '>>>' above are those printed by that
version of 'readline' and remain invisible on the screen but appear in
the file and confuse the xm test suite parser.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
tools/python/xen/xm/main.py

index 59210dc526407d94f69ebe653f5960bd858ef0ec..dd0202920a17c90662dab70cd62cab6e3647bb97 100644 (file)
@@ -25,7 +25,6 @@ import atexit
 import cmd
 import os
 import pprint
-import readline
 import shlex
 import sys
 import re
@@ -616,6 +615,7 @@ class Shell(cmd.Cmd):
 
     def preloop(self):
         cmd.Cmd.preloop(self)
+        import readline
         readline.set_completer_delims(' ')
 
     def default(self, line):